package com.example.pages;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;


public class InternalPage extends AnyPage {

	
	@FindBy(xpath = "/html/body/div/div/header/div/nav/ul/li/a")
	public WebElement MenuHomeLink;
	
	@FindBy(xpath = "/html/body/div/div/header/div/nav/ul/li[2]/a")
	public WebElement MenuMyProfileLink;
	
	@FindBy(xpath = "/html/body/div/div/header/div/nav/ul/li[3]/a")
	public WebElement MenuUserManagement;

	@FindBy(xpath = "/html/body/div/div/header/div/nav/ul/li[4]/a")
	public WebElement MenuLogoutLink;

	public Object logout;
	
	public boolean isOnThisPage() {
		return MenuLogoutLink.isDisplayed();
	}

	public void logout() {
		MenuLogoutLink.click();
		wait_.until(alertIsPresent()).accept();
	}

	@Override
	void tryToOpen() {
		MyPageFactory.getPage(driver, LoginPage.class)
				.loginAs("admin", "admin");
	}

	public UsersPage gotoUserManagementConsole() {
		MenuUserManagement.click();
		return MyPageFactory.getPage(driver, UsersPage.class);

	}

}
